package com.aso114.project.adapter;




import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.aso114.project.R;
import com.aso114.project.bean.News;

import java.util.List;


public class ExpoundingAdapter extends BaseAdapter {
    private List<News.DataBean> mDatas = null;
    private Context mContext = null;

    public ExpoundingAdapter(Context context, List<News.DataBean> datas){
        mDatas = datas;
        mContext = context;
    }
    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int i) {
        return mDatas.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh;
        if (view == null){
            vh = new ViewHolder();
            view = LayoutInflater.from(mContext).inflate(R.layout.satpractice_item, null);

            vh.name = (TextView)view.findViewById(R.id.tv_item);
//                vh.phone = (TextView)view.findViewById(R.id.sai_phone);
            view.setTag(vh);
        } else {
            vh = (ViewHolder)view.getTag();
        }
//            vh.id.setText(mDatas.get(i).id);
        vh.name.setText(mDatas.get(i).getTitle());
//            vh.phone.setText(mDatas.get(i).phone);

        return view;
    }

    public final class ViewHolder
    {
        public TextView id;
        public TextView name;
        public TextView phone;
    }
}

